package org.gjy.m8.concurrent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-07-03 15:02:20
 */
public class DbPolicy implements RejectedExecutionHandler {
    private static final Logger log = LoggerFactory.getLogger(DbPolicy.class);

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        DbRunnable dbRunnable = (DbRunnable) r;
        log.info("执行抛弃策略: {}", dbRunnable.getId());
        log.info("抛弃策略入库完成: {}", dbRunnable.getId());
    }

}
